import 'package:flutter/material.dart';
import 'package:hospitable_rental/pages/home/home/home_recommend_item.dart';
import 'package:hospitable_rental/widgets/common_image.dart';

class HomeRecommendItemWidget extends StatelessWidget {
  final HomeRecommendItem item;

  HomeRecommendItemWidget(this.item, {Key? key}) : super(key: key);

  final TextStyle _textStyle = TextStyle(
    fontSize: 14.0,
    fontWeight: FontWeight.w500,
  );

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        padding: EdgeInsets.all(10.0),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.all(Radius.circular(10.0)),
        ),
        width: (MediaQuery.of(context).size.width - 10 * 3) / 2,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Column(
              children: [
                Text(item.title, style: _textStyle),
                Text(item.subtitle, style: _textStyle),
              ],
            ),
            SizedBox(width: 10.0),
            CommonImage(
              item.imageUri,
              width: 55.0,
            ),
          ],
        ),
      ),
      onTap: () => Navigator.of(context).pushNamed(item.navigatorUri),
    );
  }
}
